#define _CRT_SECURE_NO_WARNINGS

#include "SList.h"

void test1()
{
	ListNode* plist = ListInit();

	ListPushBack(plist, 1);
	ListPushBack(plist, 2);
	ListPushBack(plist, 3);
	ListPushBack(plist, 4);
	ListPushBack(plist, 5);
	ListPrint(plist);

	ListPopBack(plist);
	ListPrint(plist);
	ListPopBack(plist);
	ListPrint(plist);
	ListPopBack(plist);
	ListPrint(plist);
	ListPopBack(plist);
	ListPrint(plist);
	ListPopBack(plist);
	ListPrint(plist);


	ListDestory(plist);
}

void test2()
{
	ListNode* plist = ListInit();

	ListPushFront(plist, 1);
	ListPushFront(plist, 2);
	ListPushFront(plist, 3);
	ListPushFront(plist, 4);
	ListPushFront(plist, 5);
	ListPushFront(plist, 6);
	ListPrint(plist);

	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);
	ListPopFront(plist);
	ListPrint(plist);

	//ListInsert(ListFind(plist, 3), 991);
	//ListPrint(plist);

	//ListInsert(ListFind(plist, 3), 992);
	//ListPrint(plist);

	//ListInsert(ListFind(plist, 3), 993);
	//ListPrint(plist);

	//ListInsert(ListFind(plist, 3), 994);
	//ListPrint(plist);

	//ListInsert(ListFind(plist, 3), 995);
	//ListPrint(plist);

	//ListErase(ListFind(plist, 991));
	//ListPrint(plist);
	//ListErase(ListFind(plist, 992));
	//ListPrint(plist);
	//ListErase(ListFind(plist, 993));
	//ListPrint(plist);
	//ListErase(ListFind(plist, 994));
	//ListPrint(plist);
	//ListErase(ListFind(plist, 995));
	//ListPrint(plist);


	ListDestory(plist);
}

void test3()
{
	ListNode* plist = ListInit();

	ListPushFront(plist, 1);
	ListPushFront(plist, 2);
	ListPushFront(plist, 3);
	ListPushFront(plist, 4);
	ListPushFront(plist, 5);
	ListPushFront(plist, 6);
	ListPrint(plist);

	ListInsert(ListFind(plist, 3), 991);
	ListPrint(plist);

	ListInsert(ListFind(plist, 3), 992);
	ListPrint(plist);

	ListInsert(ListFind(plist, 3), 993);
	ListPrint(plist);

	ListInsert(ListFind(plist, 3), 994);
	ListPrint(plist);

	ListInsert(ListFind(plist, 3), 995);
	ListPrint(plist);

	ListErase(ListFind(plist, 991));
	ListPrint(plist);
	ListErase(ListFind(plist, 992));
	ListPrint(plist);
	ListErase(ListFind(plist, 993));
	ListPrint(plist);
	ListErase(ListFind(plist, 994));
	ListPrint(plist);
	ListErase(ListFind(plist, 995));
	ListPrint(plist);

	ListDestory(plist);
}

int main()
{
	//test1();
	//test2();
	test3();

	return 0;
}